﻿//using NuGet.Packaging;
using PanhuaWin.系统管理;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PanhuaWin.仓库.下线
{
    public partial class Form小标签临时打印 : UIPage
    {
        public string 工厂编号1;
        public Form小标签临时打印()
        {
            InitializeComponent();
        }

        private void Form大标签打印_Initialize(object sender, EventArgs e)
        {

        }

        private void Form大标签打印_Load(object sender, EventArgs e)
        {
            uiComboBox加工类别.Items.Add("镀锌");
            uiComboBox加工类别.Items.Add("彩涂");
            uiComboBox加工类别.Items.Add("冷轧");//罩退的
            uiComboBox加工类别.Items.Add("彩基板");

            //包装
            uiComboBox包装.Items.Add("精包");
            uiComboBox包装.Items.Add("简包"); 
            uiComboBox包装.Items.Add("普包");
            uiComboBox包装.Items.Add("裸包");
            uiComboBox包装.Items.Add("无");
                   this.uiDatePicker报工日期.Value=DateTime.Now;
            this.uiDatePicker1.Value = DateTime.Now;
            this.uiDatePicker2.Value = DateTime.Now;
            pub.ListWorkShop(pub.sys_user, uiComboBoxWorkshop);
            this.uiTextBox班组.Text = pub.Get员工所属班组(pub.sys_user.UserTrueName);
            pub.ListRank(uiComboBoxWorkshop.SelectedValue.ToString(), this.uiComboBox等级);
            //列出没有打印大标签的小标签
            未打印();
        }

        private void 未打印()
        {
            decimal 总重量;
            decimal 总长度;
            int 总卷数;
            总重量 = 0;
            总长度 = 0;
            string sql = @"select guid,来源种类,来源产线, 工厂编号, 生产批号,  品名, 锌层,钢号,包装形式, 条码, 长度, 规格,班组, 等级, 表面状态, 仓库 , 表面处理,";
            sql += "    净重 ,'' 文本净重, 备注, 生产日期,操作人员,操作时间,颜色 from Bus_LablePrint where 1=1 ";
            if (!this.checkBox包含已经打印大标签.Checked)
            {
                sql += " and  生产批号 not in (select VolumeCodeNew from Bus_Volume) ";
                sql += " and  生产批号 not in (select VolumeCodeNew from Bus_StockInVolume) ";

            }
            if (this.checkBox2.Checked)
            {
                sql += " and 来源产线 ='" + this.uiComboBox查询产线.SelectedText + "'";
            }
            if (this.checkBox1.Checked)
            {
                sql += " and 班组 ='" + this.uiTextBox班组.Text + "'";
            }
          
                sql += " and 生产日期>='"+ this.uiDatePicker1.Value.ToString("yyyy-MM-dd") +"'";
            sql += " and 生产日期<'" + this.uiDatePicker2.Value.AddDays(1).ToString("yyyy-MM-dd") + "'";
            
            sql +=" order by [操作时间] desc ; ";

            DataTable dt = pub.GetDataTable(pub.ConnectionString,sql);
            uiDataGridView1.AutoGenerateColumns=false; ;
            uiDataGridView1.AutoSizeColumnsMode=DataGridViewAutoSizeColumnsMode.Fill;
           
            if (dt.Rows.Count >0)
            {
                for (int i= 0; i < dt.Rows.Count; i++)
                {
                    decimal 净重  = pub.Todecimal(dt.Rows[i]["净重"].ToString());
                    dt.Rows[i]["文本净重"] = Math.Round( 净重,0).ToString();
                    总重量 += 净重;
                    总长度 += pub.Todecimal(dt.Rows[i]["长度"].ToString());
                }
            }
            uiDataGridView1.DataSource = dt;
            uiDataGridView1.Refresh();
            this.uiTextBox总卷数.Text = dt.Rows.Count.ToString();
            this.uiTextBox总重量.Text = Math.Round( 总重量,0).ToString();
            this.uiTextBox总米数.Text = 总长度.ToString();
        }

        private void uiComboBox加工类别_SelectedIndexChanged(object sender, EventArgs e)
        {
            string 加工类别;
            加工类别 = this.uiComboBox加工类别.Text;
            if (加工类别 == "镀锌")
            {
                List短品名(this.uiComboBox品名, 加工类别);
                this.uiLabel前缀.Text = "PHD";
                //pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", this.uiComboBox产线);
                //pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", this.uiComboBox查询产线);
                //加工类别 镀锌 需要加上彩度的产线
                ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", "彩涂", this.uiComboBox产线);
                ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", "彩涂", this.uiComboBox查询产线);
            }
            if (加工类别 == "彩涂")
            {
                List短品名(this.uiComboBox品名, 加工类别);
                this.uiLabel前缀.Text = "PHC";
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "彩涂", this.uiComboBox产线);
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "彩涂", this.uiComboBox查询产线);

            }

            if (加工类别 == "冷轧")
            {
                List短品名(this.uiComboBox品名, 加工类别);
                this.uiLabel前缀.Text = "PHZ";
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "罩退", this.uiComboBox产线);
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "罩退", this.uiComboBox查询产线);

            }
            if (加工类别 == "彩基板")
            {
                List短品名(this.uiComboBox品名, 加工类别);
                this.uiLabel前缀.Text = "PHD";
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", this.uiComboBox产线);
                pub.ListWorkLine(this.uiComboBoxWorkshop.SelectedValue.ToString(), "镀锌", this.uiComboBox查询产线);
            }


            if (加工类别 == "冷轧")
            {
                List短品名(this.uiComboBox品名, 加工类别);
                加工类别 = "罩退";
            }
            pub.ListMaterial(this.uiComboBoxWorkshop.SelectedValue.ToString(), 加工类别, this.uiComboBox钢号);
          
            pub.ListFaceDone(加工类别, this.uiComboBox表面处理);

        }

        private void ListWorkLine(string 工厂编号, string workType,string workType2, UIComboBox uiComboBox产线)
        {
            string sql;
            sql = "SELECT [guid]     ,[WorkShopCode]     ,[DepartGuid]     ,[DepartCode]     ,[WorkLineCode]     ,[WorkLineName]     ,[AuditDate]     ,[AuditStatus]     ,[AuditId]     ,[Auditor]     ,[Remark]     ,[CreateID]     ,[Creator]     ,[CreateDate]     ,[ModifyID]     ,[Modifier]     ,[ModifyDate] FROM [Dic_WorkLine] ";
            sql += " where WorkShopCode='" + 工厂编号 + "'  ";
            if (workType != "退火")
            {
                sql += " and workType='" + workType + "' or workType = '"+ workType2 + "'";
            }
            else
            {
                sql += " and WorkLineName='二期镀退一线'";
            }



            sql += "  order by WorkLineCode  ";

            DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
            if (tb != null && tb.Rows.Count > 0)
            {
                uiComboBox产线.DataSource = tb;
                uiComboBox产线.DisplayMember = "WorkLineName";
                uiComboBox产线.ValueMember = "WorkLineCode";

                uiComboBox产线.Refresh();

            }
            else
            {

                uiComboBox产线.DataSource = null;
                uiComboBox产线.Refresh();
            }
        }

        private  void List短品名(UIComboBox uiComboBox品名, string 品名)
        {
            string sql;
            if (品名 == "彩基板")
            {
                
                sql = "select distinct[INVSHORTNAME] from[Dic_Inventory] where[INVCLASSNAME] = '彩基板'";
            }
            else
            {
                sql = "select distinct INVSHORTNAME from Dic_Inventory where INVNAME like '%" + 品名 + "%' order by INVSHORTNAME ";
            }
           
            DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
            if (tb.Rows.Count > 0)
            {
                uiComboBox品名.DataSource = tb;
                uiComboBox品名.DisplayMember = "INVSHORTNAME";
                uiComboBox品名.ValueMember = "INVSHORTNAME";
                uiComboBox品名.Refresh();
            }
            else
            {
                uiComboBox品名.DataSource = null;

                uiComboBox品名.Refresh();

            }
        }

        private void Form大标签录入_LocationChanged(object sender, EventArgs e)
        {

        }

        private void uiComboBox加工类别_SelectedIndexChanged_1(object sender, EventArgs e)
        {

        }

        private void uiTextBox新厚度_TextChanged(object sender, EventArgs e)
        {
            SetSize();
        }

        private void SetSize()
        {
            this.uiTextBox规格.Text = pub.Todecimal(this.uiTextBox新厚度.Text, 3) + "*" + pub.ToInt(this.uiTextBox新宽度.Text) + "*C";

        }

        private void uiTextBox新宽度_TextChanged(object sender, EventArgs e)
        {
            SetSize();
        }

        private void uiComboBoxWorkshop_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            pub.ListRank(this.uiComboBoxWorkshop.SelectedValue.ToString(), uiComboBox等级);
            string sql;
           工厂编号1 = this.uiComboBoxWorkshop.SelectedValue.ToString();
            sql = @"SELECT   guid, WorkShopCode, WorkShopName, AuditDate, AuditStatus, AuditId, Auditor, Remark, CreateID, Creator, 
                CreateDate, ModifyID, Modifier, ModifyDate   FROM      Dic_WorkShop     where  WorkShopCode='" + 工厂编号1 + "'      ";
            DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
            if (tb.Rows.Count > 0)
            {
                //                sql = @"SELECT    guid, WorkShopGuid, WarehouseCode, WarehouseName, WarehouseDesc, AuditDate, AuditStatus, AuditId, 
                //                Auditor, Remark, CreateID, Creator, CreateDate, ModifyID, Modifier, ModifyDate
                //FROM      Dic_Warehouse where WorkShopGuid ='" + tb.Rows[0]["guid"].ToString() + "'";
                //                DataTable tb2 = pub.GetDataTable(pub.ConnectionString, sql);
                pub.ListWareHouse(this.uiComboBox仓库编号1, tb.Rows[0]["guid"].ToString());
                if (this.uiComboBox仓库编号1.SelectedValue.ToString() != "")
                {
                    Do库位刷新1(this.uiComboBox仓库编号1.SelectedValue.ToString());
                }

            }
        }

        private void Do库位刷新1(string 仓库编号)
        {
            string sql;

            sql = @"SELECT   guid, WorkShopCode, WorkShopName, AuditDate, AuditStatus, AuditId, Auditor, Remark, CreateID, Creator, 
                CreateDate, ModifyID, Modifier, ModifyDate   FROM      Dic_WorkShop     where  WorkShopCode='" + 工厂编号1 + "'      ";
            DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
            if (tb.Rows.Count > 0)
            {
                this.uiComboBox入库库位1.DataSource = null;
                uiComboBox入库库位1.Refresh();
                pub.ListLocation(this.uiComboBox入库库位1, 工厂编号1, this.uiTextBox库位搜索.Text, 仓库编号);
            }
        }

        private void uiButton清空_Click_1(object sender, EventArgs e)
        {

            this.uiTextBox表面状态.Text = "";
            //this.uiTextBox品名.Text = "";
            this.uiTextBox备注.Text = "";
            this.uiTextBox生产批号.Text = "";
            //this.uiTextBox表面处理.Text = "";
            this.uiTextBox净重.Text = "";
            this.uiTextBox规格.Text = "";
            this.uiTextBox长度.Text = "";
        }

        private void uiButton打印_Click_1(object sender, EventArgs e)
        {
            //要从 酸洗报工  轧硬报工  产出的

            string sql;
            //验证一下信息
            string 生产批号;
            string 品名;
            string 钢号;
            string 长度;
            string 规格;
            string 等级;
            string 表面状态;
            string 表面处理;
            string 净重;
            string 备注;
            string 生产日期;
            string 仓库 = uiComboBox仓库编号1.SelectedValue?.ToString();
            string 锌层 = uiTextBox锌层.Text;
            string 包装形式 = uiComboBox包装.Text;
            string 班组 = uiTextBox班组.Text;
            string 颜色 = uiTextBox颜色.Text;

            if (string.IsNullOrEmpty(仓库))
            {
                MessageBox.Show("请选择仓库");
                return;
            }
            if (string.IsNullOrEmpty(包装形式))
            {
                MessageBox.Show("请选择包装形式");
                return;
            }

            //如果有打印了，是要覆盖重新打印，还是不打印
            //酸洗
            string sqlqueryPicklingOutput = @"select OutputVolumeNew 
                        from Bus_PicklingOutput
                        where OutputVolumeNew like '%"+ this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtPicklingOutput = pub.GetDataTable(pub.ConnectionString,sqlqueryPicklingOutput);
            if (dtPicklingOutput != null && dtPicklingOutput.Rows.Count > 0) 
            {
                MessageBox.Show("该卷已经通过正常酸洗报工流程，不可以临时打印");
                return;
            }

            //罩退
            string sqlCoverFire = @"select OutputVolumeNew 
                                    from Bus_CoverFireOutput
                                    where OutputVolumeNew like '%"+ this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtCoverFire = pub.GetDataTable(pub.ConnectionString, sqlCoverFire);
            if (dtCoverFire != null && dtCoverFire.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常罩退报工流程，不可以临时打印");
                return;
            }

            //退火
            string sqlFireOutput = @"select OutputVolumeNew 
                            from [dbo].Bus_FireOutput
                            where OutputVolumeNew like '%" + this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtFireOutput  = pub.GetDataTable(pub.ConnectionString, sqlFireOutput);
            if (dtFireOutput != null && dtFireOutput.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常退火报工流程，不可以临时打印");
                return;
            }

            //轧硬
            string sqlHardOutput = @"select OutputVolumeNew 
                                    from [dbo].Bus_HardOutput
                                    where OutputVolumeNew like '%" + this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtHardOutput = pub.GetDataTable(pub.ConnectionString, sqlHardOutput);
            if (dtHardOutput != null && dtHardOutput.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常轧硬报工流程，不可以临时打印");
                return;
            }

            //喷涂
            string sqlPaintOutput = @"select OutputVolumeNew 
                                    from [dbo].Bus_PaintOutput
                                    where OutputVolumeNew like  '%" + this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtPaintOutputt = pub.GetDataTable(pub.ConnectionString, sqlPaintOutput);
            if (dtPaintOutputt != null && dtPaintOutputt.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常喷涂报工流程，不可以临时打印");
                return;
            }

            //硅钢
            string sqlSiOutput = @"select OutputVolumeNew 
                                    from [dbo].Bus_SiOutput
                                    where OutputVolumeNew like  '%" + this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtSiOutput = pub.GetDataTable(pub.ConnectionString, sqlSiOutput);
            if (dtSiOutput != null && dtSiOutput.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常硅钢报工流程，不可以临时打印");
                return;
            }

            //镀锌
            string sqlZincOutput = @"select OutputVolumeNew 
                                    from [dbo].Bus_ZincOutput
                                    where OutputVolumeNew like  '%" + this.uiTextBox生产批号.Text.Trim().Replace("--", "-") + "%'";
            DataTable dtZincOutput = pub.GetDataTable(pub.ConnectionString, sqlZincOutput);
            if (dtZincOutput != null && dtZincOutput.Rows.Count > 0)
            {
                MessageBox.Show("该卷已经通过正常镀锌报工流程，不可以临时打印");
                return;
            }



            生产批号 = uiLabel前缀.Text+this.uiTextBox生产批号.Text.Trim().Replace("--", "-");
            sql = "SELECT  生产批号 ";
            sql += " from  Bus_LablePrint where 生产批号='" + 生产批号 + "'";
            sql += " union all ";
            sql += " SELECT  VolumeCodeNew   ";
            sql += " from  Bus_StockInVolume where VolumeCodeNew='" + 生产批号 + "'";

            DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
            if (tb.Rows.Count > 0)
            {
                MessageBox.Show(生产批号 + "已经打印过了，请联系一下管理员处理", "提示", MessageBoxButtons.OK);
                return;
            }

            生产日期 = this.uiDatePicker报工日期.Value.ToString("yyyy-MM-dd");
            品名 = this.uiComboBox品名.Text.Trim().Replace("--", "");
            if (品名 == "")
            {
                MessageBox.Show("品名有问题", "提示", MessageBoxButtons.OK);
                return;
            }
            //钢号 = this.uiComboBox钢号.SelectedValue?.ToString();
            钢号 = this.uiComboBox钢号.Text?.ToString();
            规格 = this.uiTextBox规格?.Text.Trim().Replace("--", "");
            if (!pub.IsRightSize(规格))
            {
                MessageBox.Show("规格输入格式有问题", "提示", MessageBoxButtons.OK);
                return;
            }
            等级 = this.uiComboBox等级.SelectedValue.ToString();
            表面状态 = this.uiTextBox表面状态.Text.Trim().Replace("--", "");
            表面处理 = this.uiComboBox表面处理.Text.Trim().Replace("--", ""); 
            净重 = pub.Todecimal(this.uiTextBox净重.Text, 0);
            if (净重 == "0")
            {
                MessageBox.Show("净重有问题", "提示", MessageBoxButtons.OK);
                return;
            }
            长度 = pub.Todecimal(this.uiTextBox长度.Text, 0);
            if (长度 == "0")
            {
                MessageBox.Show("长度有问题", "提示", MessageBoxButtons.OK);
                return;
            }
            备注 = this.uiTextBox备注.Text.Trim().Replace("--", "");

            BarTender.Application ba = new BarTender.Application();
            BarTender.Format bfmt;
            bfmt = new BarTender.Format();
            switch (uiComboBox加工类别.Text)
            {
                case "镀锌":
                    bfmt = ba.Formats.Open(System.Windows.Forms.Application.StartupPath + "\\攀华镀锌小标签.btw");
                    break;
                case "彩涂":
                    bfmt = ba.Formats.Open(System.Windows.Forms.Application.StartupPath + "\\攀华彩涂小标签.btw");
                    bfmt.SetNamedSubStringValue("颜色", 颜色);
                    break;
                case "冷轧":
                    bfmt = ba.Formats.Open(System.Windows.Forms.Application.StartupPath + "\\攀华罩退小标签.btw");
                    break;
                case "彩基板":
                    bfmt = ba.Formats.Open(System.Windows.Forms.Application.StartupPath + "\\攀华镀锌小标签.btw");
                    break;

            }
            bfmt.SetNamedSubStringValue("生产批号", 生产批号);
            bfmt.SetNamedSubStringValue("品名", 品名);
            bfmt.SetNamedSubStringValue("钢号", 钢号);
            bfmt.SetNamedSubStringValue("长度", 长度);
            bfmt.SetNamedSubStringValue("规格", 规格);
            bfmt.SetNamedSubStringValue("等级", 等级);
            bfmt.SetNamedSubStringValue("表面状态", 表面状态);
            bfmt.SetNamedSubStringValue("表面处理", 表面处理);
            bfmt.SetNamedSubStringValue("净重", 净重);
            bfmt.SetNamedSubStringValue("备注", 备注);
            bfmt.SetNamedSubStringValue("生产日期", 生产日期);
            bfmt.SetNamedSubStringValue("班组", 班组);
            bfmt.SetNamedSubStringValue("仓库", 仓库);
            //先不打印小标签
            //bfmt.PrintOut();
            sql = "delete Bus_LablePrint where 生产批号='" + 生产批号 + "'";
            pub.ExecuteSql(pub.ConnectionString, sql, "临时小标签打印前删除");
            sql = "insert into Bus_LablePrint(guid,来源种类,来源产线, 工厂编号, 生产批号,  品名, 钢号, 条码, 长度, 规格, 等级, 表面状态,  ";
            sql += " 表面处理, 净重, 备注, 生产日期,  操作ip, 操作人员, 操作时间,仓库,锌层,包装形式,班组,颜色 ) ";
            sql += " values(newid(),'"+"临时"+ uiComboBox加工类别.Text+"小标签" + "','"+ this.uiComboBox产线.Text  +"','" + this.uiComboBoxWorkshop.SelectedValue.ToString() + "','" + 生产批号 + "',";
            sql += " '" + 品名 + "','" + 钢号 + "','" + 生产批号 + "','" + 长度 + "','" + 规格 + "','" + 等级 + "','" + 表面状态 + "',";
            sql += " '" + 表面处理 + "','" + 净重 + "','" + 备注 + "','" + 生产日期 + "','" 
                + pub.getMac() + "','" + pub.sys_user.UserTrueName + "',getdate(),'"+ 仓库 + "','"+ 锌层 + "','"+ 包装形式 + "','"+ 班组 + "','"+ 颜色 + "')";
            pub.ExecuteSql(pub.ConnectionString, sql, "临时小标签打印塞入");
            ba.Quit();
            未打印();
        }

        private void uiDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex == 0)
            {
                if (MessageBox.Show("确定删除？", "警告", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    string 填报人 = this.uiDataGridView1.Rows[e.RowIndex].Cells["C操作人员"].Value.ToString();
                    string VolumeCodeNew = this.uiDataGridView1.Rows[e.RowIndex].Cells["C卷号"].Value.ToString();
                    if (填报人 != pub.sys_user.UserTrueName)
                    {
                        MessageBox.Show("您不可以删除其他人员填报的数据", "提示", MessageBoxButtons.OK);
                        return;
                    }
                    //不能删除已经打印大标签的
                    string sql = "select VolumeCodeNew from Bus_StockInVolume where VolumeCodeNew ='" + VolumeCodeNew + "'";
                    sql += "union all ";
                    sql += " select VolumeCodeNew from Bus_Volume where VolumeCodeNew ='" + VolumeCodeNew + "'";
                    DataTable tb = pub.GetDataTable(pub.ConnectionString, sql);
                    if (tb.Rows.Count>0 )
                    {
                        MessageBox.Show("您不可以删除已经入库的临时小标签，请联系管理员", "提示", MessageBoxButtons.OK);
                        return;
                    }
                    DataTable dt = uiDataGridView1.DataSource as DataTable;
                    string guid = uiDataGridView1.Rows[e.RowIndex].Cells["Cguid"].Value.ToString();
                    sql = "delete from Bus_LablePrint where guid = '"+ guid + "'";
                    int r = pub.ExecuteSql(pub.ConnectionString,sql,"删除临时小标签");
                    未打印();
                }
               

            }
        }

        private void uiComboBox品名_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void uiLabel19_Click(object sender, EventArgs e)
        {

        }
        

        private void uiButton刷新_Click(object sender, EventArgs e)
        {
            未打印();
        }

        private void uiButton导出_Click(object sender, EventArgs e)
        {

        }

        private void uiComboBox产线_SelectedIndexChanged(object sender, EventArgs e)
        {
            string workLineCode;
            if (this.uiComboBox产线.SelectedValue.ToString() != "")
            {
                workLineCode = this.uiComboBox产线.SelectedValue.ToString();
                pub.全局工厂编号 = pub.全局工厂编号;
                Dic_WorkLine dic_workline = pub.GetWorkLineByLineCode(pub.全局工厂编号, workLineCode);
                //if (dic_workline.DepartCode != null)
                //{
                //    Dic_Depart dic_depart = pub.GetDepartByCode(dic_workline.DepartCode, pub.全局工厂编号);
                //    if (dic_depart.DepartCode != "")
                //    {
                //        this.uiTextBox部门1.Text = dic_depart.DepartCode;
                //        this.uiTextBox部门名称1.Text = dic_depart.DepartName;
                //    }
                //    else
                //    {
                //        this.uiTextBox部门1.Text = "";
                //        this.uiTextBox部门名称1.Text = "";
                //    }
                //}
                //else
                //{
                //    this.uiTextBox部门1.Text = "";
                //    this.uiTextBox部门名称1.Text = "";
                //}

                this.uiComboBox仓库编号1.SelectedValue = pub.根据产线获得仓库编号(this.uiComboBox产线.SelectedText);
                //pub.ListWorkType(pub.全局工厂编号, FormWorkType, this.uiComboBox去向);
                //pub.ListWorkTeam(pub.全局工厂编号, workLineCode, this.uiComboBoxWorkTeam);
            }
        }
    }
}
